﻿
@{
    ViewBag.Title = "供货商-指效";
}
<link type="text/css" rel="stylesheet" href="/Static/styles/bootstrap.min.css">
<link type="text/css" rel="stylesheet" href="~/Static/css/theme/default/style.css" />
<link href="~/Static/js/layui/css/layui.css" rel="stylesheet" />
<link href="~/Static/js/layer/need/layer.css" rel="stylesheet" />
<script src="/Static/js/jquery/jquery-1.11.1.min.js"></script>
<script src="~/Static/js/layui/layui.js"></script>
<script src="~/Static/js/layer/layer.js"></script>
<script src="~/Static/js/layer/layer.tools.js"></script>
<style>
    .panel {
        border: 2px solid #e5e5e5 !important;
    }

    .top-navbar-index {
        position: inherit;
        width: 100%;
        margin-bottom: 0;
    }

    .row {
        margin: 0;
    }
</style>
@Html.Raw(ViewBag.SysAdminMainNavbar)
<input type="hidden" name="currentMid" id="currentMid" value="@ViewBag.CurrentMid" />
<input type="hidden" id="secondMenuId" name="secondMenuId" value="@ViewBag.SecondMenuId" />
<nav id='menu'>
    <ul class='nav'>
        <li class='active' style="height:41px;">
        </li>
    </ul>
</nav>
<div class='row page-content with-menu'>
    <div id='menuActions' style="float:right;">
        <a href="javascript:;" onclick="add()" class="btn btn-primary" val="{0}">新增</a>
    </div>
    <table class='layui-table'>
        <thead>
            <tr class='text-left'>
                <th class='w-60px'>序号</th>
                <th>供应商编号</th>
                <th>供应商名称</th>
                <th>供货合格率</th>
                <th>联系地址</th>
                <th>联系人姓名</th>
                <th>手机电话</th>
                <th>座机</th>
                <th>规模</th>
                <th>行业</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody id="tbList"></tbody>
    </table>
    <div class='table-footer'>
        <div class='pull-left text-danger'></div>
        <div style='float:right; clear:none;' class='pager form-inline'>
            <div id="myPager"></div>
        </div>
    </div>
</div>
<script type="text/javascript">

    $(function () {
        getList();
    });
    function add() {
        window.location.href = "/Supplier/addedit?id=0&mid=" + $("#currentMid").val() + "&secondMenuId=" + $("#secondMenuId").val();
    }
    function edit(obj) {
        var id = $(obj).attr("val");
        window.location.href = "/Supplier/addedit?id=" + id + "&mid=" + $("#currentMid").val() + "&secondMenuId=" + $("#secondMenuId").val();
    }

    function look(obj) {
        var id = $(obj).attr("val");
        window.location.href = "/Supplier/Readonly?id=" + id + "&mid=" + $("#currentMid").val() + "&secondMenuId=" + $("#secondMenuId").val();
    }

    function del(obj) {
        var id = $(obj).attr("val");
        win.confirm("确认要删除吗?", function () {
            $.post("/Supplier/deletedata", { id: id }, function (data) {
                if (data.Code == 200) {
                    win.success("删除成功");
                    getList();
                } else {
                    win.alert("删除失败");
                }
            });
        });
    }
    var pageIndex = 1, pageSize = 10, count = 0;
    function getList() {
        win.showLoading();
        /**/
        $.post("/Supplier/GetList", { pageIndex: pageIndex, pageSize: pageSize, name: "", mid: $("#currentMid").val(), secondMenuId: $("#secondMenuId").val() }, function (data) {
            /**/
            win.hideLoading();
            if (data.Code == 200) {
                $("#tbList").html(data.Data);
                count = data.TotalCount;
                initPage();
            } else {
                win.alert("获取数据失败");
            }
        });
    }

    function initPage() {
        layui.use(['laypage', 'layer'], function () {
            var laypage = layui.laypage
                , layer = layui.layer;
            //完整功能
            laypage.render({
                elem: 'myPager'
                , limit: pageSize
                , curr: pageIndex
                , count: count
                , theme: '#1E9FFF'
                , layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']
                , jump: function (obj, first) {
                    if (!first) {
                        pageIndex = obj.curr;
                        pageSize = obj.limit;
                        getList();
                    }
                }
            });
        });
    }
</script>

